import BaseComponent from "http://component.119safe.cn/component/base.js";

new class Progress extends BaseComponent
{
	/*
	 * running		是否运动中
	 * value		百分比
	 * color		4种颜色(red，orange，green，其它值为blue)
	 */
	Properties = { "running": null, "value": 0, "color": "" };

	render() { super.render(this.constructor.name); }

	preRender()
	{
		this.Properties.running = this.Properties.running == 1 ? "progress-striped active" : "";

		if (["red", "orange", "green"].indexOf(this.Properties.color) > -1)
			this.Properties.color = "progress-bar-" + { red: "danger", orange: "warning", green: "success" }[this.Properties.color];
		else
			this.Properties.color = "";
	}

	Content = `
<div class="progress progress-mini {running}">
	<div style="width:{value}%" class="progress-bar {color}"></div>
</div>
`;
}().render();
